let excelData = [
  {
    name: "用户表",
    data: [
      ["用户ID", "用户昵称", "用户性别", "用户年龄"],
      [10000, "张三", "男", 15],
      [10001, "李四", "男", 40],
    ],
  },
];

const path = require('path')
const xlsx = require("node-xlsx");
const fs = require("fs");
fs.writeFile(path.join(__dirname, "../files/11.xls"), xlsx.build(excelData), function (writeErr) {
  if (writeErr) {
    return console.log("文件写入失败", writeErr);
  }
  fs.readFile(path.join(__dirname, "../files/11.xls"), "utf8", function (err, dataStr) {
    if (err) {
      return console.log("文件读取失败", err);
    }
    console.log("---------------");
    console.log(dataStr);
  });
});
